procedure tower(k,a,b,c:longint); // TO GO: tower(n,1,3,2);
begin
     if k>1 then tower(k-1,a,c,b);
		 writeln(k,' ',a,' ',b);
     if k>1 then tower(k-1,c,b,a)
end;